package com.ruoyi.qsng.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.uuid.SnowFlakeUtil;
import com.ruoyi.qsng.domain.KShoppingMall;
import com.ruoyi.qsng.mapper.KShoppingMallMapper;
import com.ruoyi.qsng.service.IKShoppingMallService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 积分商城Service业务层处理
 *
 * @author kanglou
 * @date 2023-06-07
 */
@Service
public class KShoppingMallServiceImpl implements IKShoppingMallService {
    @Autowired
    private KShoppingMallMapper kShoppingMallMapper;

    /**
     * 查询积分商城
     *
     * @param id 积分商城主键
     * @return 积分商城
     */
    @Override
    public KShoppingMall selectKShoppingMallById(String id) {
        return kShoppingMallMapper.selectKShoppingMallById(id);
    }

    /**
     * 查询积分商城列表
     *
     * @param kShoppingMall 积分商城
     * @return 积分商城
     */
    @Override
    public List<KShoppingMall> selectKShoppingMallList(KShoppingMall kShoppingMall) {
        return kShoppingMallMapper.selectKShoppingMallList(kShoppingMall);
    }

    /**
     * 新增积分商城
     *
     * @param kShoppingMall 积分商城
     * @return 结果
     */
    @Override
    public int insertKShoppingMall(KShoppingMall kShoppingMall) {
        kShoppingMall.setId(SnowFlakeUtil.getNextId());
//        kShoppingMall.setCreateTime(DateUtils.getNowDate());
        return kShoppingMallMapper.insertKShoppingMall(kShoppingMall);
    }

    /**
     * 修改积分商城
     *
     * @param kShoppingMall 积分商城
     * @return 结果
     */
    @Override
    public int updateKShoppingMall(KShoppingMall kShoppingMall) {
        kShoppingMall.setUpdateTime(DateUtils.getNowDate());
        return kShoppingMallMapper.updateKShoppingMall(kShoppingMall);
    }

    /**
     * 批量删除积分商城
     *
     * @param ids 需要删除的积分商城主键
     * @return 结果
     */
    @Override
    public int deleteKShoppingMallByIds(String[] ids) {
        return kShoppingMallMapper.deleteKShoppingMallByIds(ids);
    }

    /**
     * 删除积分商城信息
     *
     * @param id 积分商城主键
     * @return 结果
     */
    @Override
    public int deleteKShoppingMallById(String id) {
        return kShoppingMallMapper.deleteKShoppingMallById(id);
    }
}
